﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTO_HealthInsurance;
using BLL_HealthInsurance;

namespace HealthInsuranceMgm.Admin
{
    public partial class EmployeeRegister : System.Web.UI.Page
    {
        DTOEmployee objdtoEmp = new DTOEmployee();
        BLLEmployee objbllEmp = new BLLEmployee();
        
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        public void message(string script)
        {

            Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", script, true);
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                string Designation = txtDesignation.Text;
                string Joindate = txtjoindate.Text;
                float Salary = float.Parse(txtsalary.Text);
                string firstname = txtFirstName.Text;
                string lastname = txtlastname.Text;
                string username = txtusername.Text;
                string password = txtpassword.Text;
                string  Address = txtaddress.Text;
                string contactno = txtcontact.Text;
                string state = txtstate.Text;
                string country = txtcountry.Text;
                string city = txtcity.Text;
               string status = Txtstatus.Text;
                int policyid=Int32.Parse( txtpolicyid.Text);

                objdtoEmp.EmpDesignation= Designation;
                objdtoEmp.EmpJoindate = Joindate;
                objdtoEmp.EmpSalary = Salary;
                objdtoEmp.EmpFirstName = firstname;
                objdtoEmp.EmpLastName = lastname;
                objdtoEmp.EmpUserName = username;
                objdtoEmp.EmpPassword = password;
                objdtoEmp.EmpAddress = Address;
                objdtoEmp.EmpContactNo = contactno;
                objdtoEmp.EmpState = state;
                objdtoEmp.EmpCountry = country;
                objdtoEmp.EmpCity = city;
                objdtoEmp.EmpPolicyStatus = status;
                objdtoEmp.PolicyId = policyid;
                int i = objbllEmp.insertEmployee(objdtoEmp);

                if (i > 0)
                {

                    message("alert('Insert Succesfull');");

                }
            }
        }
    }
}